import frida, sys


def on_message(message, data):
    if message['type'] == 'send':
        print("[*] {0}".format(message['payload']))
    else:
        print(message)


js_code = """

let MainActivity = Java.use("com.ph0en1x.android_crackme.MainActivity");
        MainActivity["getFlag"].implementation = function () {
            console.log(`MainActivity.getFlag is called`);
            let result = this["getFlag"]();
            console.log(`MainActivity.getFlag result=${result}`);
            send(result)
            return result;
        };

"""

# process = frida.get_usb_device().attach('com.ph0en1x.android_crackme')
# script = process.create_script(js_code)
# script.on("message", on_message)
# script.load()
# sys.stdin.read()

result = 'ek`fz@q2^x/t^fn0mF^6/^rb`qanqntfg^E`hq|'
flag = ''
for i in result:
    flag += chr(ord(i) + 1)

print(flag)
